From 50fba61bdc8a8c29d62ca52f59c7cd0c0f5bc65f Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 4 Aug 2013 23:01:55 +0000 Subject: [PATCH] fix memory leak in strip_html(). --- gpsbabel/util.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpsbabel/util.cc b/gpsbabel/util.cc index 1bc16c2e8..d908e8c91 100644 --- a/gpsbabel/util.cc +++ b/gpsbabel/util.cc @@ -1563,7 +1563,8 @@ strip_html(const utf_string *in) char* outstring, *out; // If toUtf8() is used here, we double encode in the OSM test case. // this may be a bug here or elsewhere. - char* instr = xstrdup(in->utfstring.toLatin1().data()); + char* incopy, *instr; + incopy = instr = xstrdup(in->utfstring.toLatin1().data()); char tag[8]; unsigned short int taglen = 0; @@ -1637,6 +1638,9 @@ strip_html(const utf_string *in) instr++; } *out++ = 0; + if (incopy) { + xfree(incopy); + } return (outstring); } -- 2.30.2